{extend name="layout" /}
{block name="body"}
  <div class="row">
    <div class="col-lg-12">
      <div class="card">
        <div class="card-toolbar d-flex flex-column flex-md-row">
          <div class="toolbar-btn-action">
            {if condition="check_rule('admin/document/add', [1,2,3])"}
            <a class="btn btn-primary m-r-5" href="{:url('document/add', 'model_id='.$model['id'])}"><i class="mdi mdi-plus"></i> 新增</a>
            {/if}
            {if condition="check_rule('admin/document/setStatus', [1,2,3])"}
            <a class="btn btn-success m-r-5 ajax-post confirm" href="{:url('document/setStatus', 'status=1')}" target-form="ids"><i class="mdi mdi-check"></i> 启用</a>
            <a class="btn btn-warning m-r-5 ajax-post confirm" href="{:url('document/setStatus', 'status=0')}" target-form="ids"><i class="mdi mdi-block-helper"></i> 禁用</a>
            {/if}
            {if condition="check_rule('admin/document/delete', [1,2,3])"}
            <a class="btn btn-danger ajax-post confirm" href="{:url('document/delete', 'model_id='.$model['id'])}" target-form="ids"><i class="mdi mdi-window-close"></i> 删除</a>
            {/if}
          </div>

          <form class="search-bar ml-md-auto" method="get" action="{$model['en_title']|url}" role="form">
            <input type="hidden" name="search_field" id="search-field" value="title" />
            <div class="form-inline">
              <div class="form-group mb-2 mr-2">
                <input class="form-control" type="text" name="keywords" placeholder="请输入搜索的标题" value="{$keyword}">
              </div>
              <div class="form-group mb-2 mr-2">
                <div class="input-group"
                  data-provide="datepicker"
                  data-today-highlight="true"
                  data-autoclose="false"
                  data-date-format="yyyy-mm-dd"
                >
                  <input type="text" class="form-control" placeholder="开始时间" name="start_time" value="{$start_time}" style="max-width:120px">
                  <div class="input-group-prepend input-group-append">
                    <span class="input-group-text">至</span>
                  </div>
                  <input type="text" class="form-control" placeholder="结束时间" name="end_time" value="{$end_time}" style="max-width:120px">
                </div>
              </div>
              <div class="form-group mb-2 mr-2">
                <select name="cid" class="form-control selectpicker" id="cid">
                  {volist name="columns" id="vo"}
                  <option value="{$vo.id}" {if condition="$cid == $vo.id"}selected{/if}>{$vo.title_show|raw}</option>
                  {/volist}
                </select>
              </div>
              <button class="btn btn-default mb-2"><i class="mdi mdi-magnify"></i> 搜索</button>
            </div>
          </form>
        </div>
        <div class="card-body">
          
          <div class="table-responsive">
            <table class="table table-bordered">
              <thead>
                <tr>
                  <th>
                    <div class="custom-control custom-checkbox">
                      <input type="checkbox" class="custom-control-input" id="check-all">
                      <label class="custom-control-label" for="check-all"></label>
                    </div>
                  </th>
                  <th>编号</th>
                  <th>标题</th>
                  <th>栏目名称</th>
                  <th>点击量</th>
                  <th>发布人</th>
                  <th>更新时间</th>
                  <th>排序</th>
                  <th>状态</th>
                  <th>操作</th>
                </tr>
              </thead>
              <tbody>
                {volist name="list" id="vo"}
                <tr>
                  <td>
                    <div class="custom-control custom-checkbox">
                      <input type="checkbox" class="custom-control-input ids" name="ids[]" value="{$vo.id}" id="ids-{$vo.id}">
                      <label class="custom-control-label" for="ids-{$vo.id}"></label>
                    </div>
                  </td>
                  <td>{$vo.id}</td>
                  <td>{$vo.title}</td>
                  <td>{$vo.column_title}</td>
                  <td>{$vo.clicks}</td>
                  <td>{$vo.adminname}</td>
                  <td>{$vo.create_time}</td>
                  <td>{$vo.sort}</td>
                  <td>{:show_status_op($vo.status)}</td>
                  <td>
                    <div class="btn-group">
                      {if condition="check_rule('admin/document/edit', [1,2,3])"}
                      <a class="btn btn-xs btn-default" href="{:url('document/edit', 'id='.$vo['id'])}" title="编辑" data-toggle="tooltip" data-original-title="编辑"><i class="mdi mdi-pencil"></i></a>
                      {/if}
                      {if condition="$model['type'] == 2"}
                      {if condition="check_rule('admin/document/delete', [1,2,3])"}
                      <a class="btn btn-xs btn-default ajax-get confirm" href="{:url('document/delete', 'ids='.$vo['id'])}" title="删除" data-toggle="tooltip" data-original-title="删除"><i class="mdi mdi-window-close"></i></a>
                      {/if}
                      {else /}
                      {if condition="check_rule('admin/document/delete', [1,2,3])"}
                      <a class="btn btn-xs btn-default ajax-get confirm" href="{:url('document/delete', 'ids='.$vo['id'].'&table='.$model['table'])}" title="删除" data-toggle="tooltip" data-original-title="删除"><i class="mdi mdi-window-close"></i></a>
                      {/if}
                      {/if}
                    </div>
                  </td>
                </tr>
                {/volist}
              </tbody>
            </table>
          </div>
          {$list|raw}
 
        </div>
      </div>
    </div>
    
  </div>
{/block}
{block name="otherjs"}
{assign name="useDatepicker" value="1" /}
{include file="../application/admin/view/form/formjs.html" /}
{/block}